/**
 * 
 */
package com.maohi.software.tupuna.ui;

import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JButton;
import javax.swing.JPanel;

import org.jdesktop.swingx.border.DropShadowBorder;

import com.google.inject.Inject;
import com.google.inject.name.Named;
import com.maohi.software.tupuna.constants.UIConstant;

/**
 * @author heifara
 * 
 */
public class HeaderUI extends JPanel {

	private static final long serialVersionUID = 1L;

	@Inject
	@Named(UIConstant.CONFIGURATION_BUTTON_UI)
	private JButton configurationButton;

	@Inject
	@Named(UIConstant.PROFILE_BUTTON_UI)
	private JButton profileButton;

	@Inject
	@Named(UIConstant.CLOSE_BUTTON_UI)
	private JButton closeButton;

	@Inject
	@Named(UIConstant.MINIMIZE_BUTTON_UI)
	private JButton minimizeButton;

	@Inject
	@Named(UIConstant.MAXIMIZE_BUTTON_UI)
	private JButton maximizeButton;

	@Inject
	protected void initUI() {
		this.setBorder(new DropShadowBorder(false));
		this.setBackground(Color.LIGHT_GRAY);

		this.update();
	}

	private void update() {

		this.removeAll();
		this.setLayout(new GridBagLayout());

		GridBagConstraints iConstraint = new GridBagConstraints();

		iConstraint.weightx = 1;
		iConstraint.weighty = 1;
		iConstraint.anchor = GridBagConstraints.BASELINE_TRAILING;
		this.add(this.profileButton, iConstraint);
		iConstraint.weightx = 0;
		iConstraint.weighty = 0;

		this.add(this.configurationButton, iConstraint);
	}
}
